<?php $this->extend('comm/page');?>

<div class="panel panel-default panel-intro">
    <?php echo $this->build_heading(); ?>

    <div class="panel-body">
        <!-- 搜索 -->
        <div id="search" class="row">
            <form class="layui-form" lay-filter="search">
                <div class="col-xs-12 col-sm-6 col-md-3 hidden-xs">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">最近通话：</label>
                        <div class="layui-input-block">
                            <input type="text" name="search_time" class="layui-input date-range">
                        </div>
                    </div>
                </div>
                <?php if($showApp): ?>
                <div class="col-xs-12 col-sm-6 col-md-3">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">APP名称：</label>
                        <div class="layui-input-block">
                            <?php echo $this->build_select('app_id', $app, [], ['lay-search' => 'true']); ?>                        </div>
                    </div>
                </div>
                <?php endif; ?>
                <?php if($showWaiter): ?>
                <div class="col-xs-12 col-sm-6 col-md-3">
                    <div class="layui-form-item">
                        <label class="layui-form-label mg-label">接待客服：</label>
                        <div class="layui-input-block">
                            <input type="text" name="account" placeholder="接待客服：" autocomplete="off" class="layui-input">
                        </div>
                    </div>
                </div>
                <?php endif; ?>
            </form>
        </div>

        <div id="toolbar" class="toolbar">
            <?php echo $this->build_toolbar(['refresh', 'search']); ?>
            <a href="javascript:;" class="btn btn-default btn-return">
                <i class="fa fa-reply"></i>
                返回
            </a>
        </div>
        <table id="table" lay-filter="table" class="mr-b-sm"></table>
    </div>
</div>


<!-- 操作 -->
<script type="text/html" id="operate">
    <?php if($container->auth->check('/admin/chat/history/info', $userInfo['id'])): ?>
        <button type="button" class="btn btn-xs btn-primary operate-info" data-idx="{{ d.id }}"><i class="fa fa-eye"> 查看通信信息</i></button>
    <?php endif; ?>
    <?php if($container->auth->check('/admin/chat/visit', $userInfo['id'])): ?>
        <button type="button" class="btn btn-xs btn-info operate-visit" data-idx="{{ d.visitid }}"><i class="fa fa-eye"> 查看游客信息</i></button>
    <?php endif; ?>
</script>